package com.ksd.modules.members.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ksd.common.annotation.ApiLog;
import com.ksd.common.controller.BaseController;
import com.ksd.common.core.result.R;
import com.ksd.common.po.BatchIdsPO;
import com.ksd.common.web.annotation.RepeatSubmit;
import com.ksd.modules.members.po.AdminUserWalletRecordsSavePO;
import com.ksd.modules.members.po.AdminUserWalletRecordsSearchPO;
import com.ksd.modules.members.service.IAdminUserWalletRecordsService;
import com.ksd.modules.members.vo.AdminUserWalletRecordsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 平台up主用户 前端控制器
 * </p>
 *
 * @author Auto Generator
 * @since 2023-08-15
 */
@RestController
public class AdminUserWalletRecordsController extends BaseController {


    @Autowired
    private IAdminUserWalletRecordsService adminUserWalletRecordsService;

    /**
     * 查询首页钱包收入模板接口
     * @param adminUserWalletRecordsSearchPO
     * @return
     */
    @PostMapping("/users/wallet/records/list")
    public R<Page<AdminUserWalletRecordsVo>> findAdminUserWalletRecordss(@Validated @RequestBody AdminUserWalletRecordsSearchPO adminUserWalletRecordsSearchPO){
        return R.data(adminUserWalletRecordsService.findAdminUserWalletRecordss(adminUserWalletRecordsSearchPO));
    }

    /**
     * 【钱包收入】 - 保存和更新
     * @param adminUserWalletRecordssSavePO
     * @return
     */
    @PostMapping("/users/wallet/records/saveupdate")
    @ApiLog("【钱包收入】 - 保存和更新")
    @RepeatSubmit
    public R<AdminUserWalletRecordsVo> saveUpdateAdminUserWalletRecords(@Validated @RequestBody AdminUserWalletRecordsSavePO adminUserWalletRecordssSavePO){
        return R.data(adminUserWalletRecordsService.saveUpdateAdminUserWalletRecords(adminUserWalletRecordssSavePO));
    }

    /**
     * 【钱包收入】 - 根据id查询明细
     * @param id
     * @return
     */
    @PostMapping("/users/wallet/records/get/{id}")
    public R<AdminUserWalletRecordsVo> getAdminUserWalletRecordsById(@PathVariable("id")Long id){
        return R.data(adminUserWalletRecordsService.getAdminUserWalletRecordsById(id));
    }

    /**
     * 【钱包收入】- 批量物理删除
     *
     * @return
     */
    @PostMapping("/users/wallet/records/batch/remove")
    @ApiLog("【钱包收入】- 批量物理删除")
    @RepeatSubmit
    public R<Boolean> batchRemovesAdminUserWalletRecords(@RequestBody BatchIdsPO batchIdsPO) {
        return R.data(adminUserWalletRecordsService.batchRemovesAdminUserWalletRecords(batchIdsPO));
    }

    /**
     * 【钱包收入】- 根据ID恢复删除
     * @param id
     * @return
     */
    @PostMapping("/users/wallet/records/remove/{id}")
    @ApiLog("【钱包收入】- 根据ID恢复删除")
    public R<Boolean> removeAdminUserWalletRecordsById(@PathVariable("id")Long id){
        return R.data(adminUserWalletRecordsService.removeAdminUserWalletRecordsById(id));
    }

    /**
     * 【钱包收入】-【订单】- 绑定订单
     *
     * @return
     */
    @PostMapping("/users/wallet/records/userbind")
    @ApiLog("【钱包收入】-【订单】- 绑定订单")
    @RepeatSubmit
    public R<Boolean> bindUserOrder(
            @RequestParam("uuid")String uuid,
            @RequestParam("price") String price
    ) {
        return R.data(adminUserWalletRecordsService.bindUserOrder(uuid, price));
    }
}
